import request from '../utils/request';

export async function findActivity(params) {
  return request('/maintenance/searchactivitylist', {
    method: 'POST',
    body: params,
  });
}

export async function getTime() {
  return request('/maintenance/findinterval', {
    method: 'POST',
  });
}

export async function addActivity(params) {
  return request('/maintenance/addactivity', {
    method: 'POST',
    body: params,
  });
}

export async function deleteActivity(params) {
  return request('/maintenance/deleteactivity', {
    method: 'POST',
    body: params,
  });
}

export async function updateActivityStatus(params) {
  return request('/maintenance/changeactivitystatus', {
    method: 'POST',
    body: params,
  });
}

export async function findActivityDetailList(params) {
  return request(`/maintenance/findactivitydetaillist?dealerNo=${params.dealerNo}&activityNo=${params.activityNo}`);
}


export async function findActivityRebateList(params) {
  return request(`/maintenance/findactivityrebatelist?dealerNo=${params.dealerNo}&activityNo=${params.activityNo}&activityDate=${params.activityDate}`);
}

export async function editActivityDetail(params) {
  return request('/maintenance/editactivitydetail', {
    method: 'POST',
    body: params,
  });
}

export async function searchMaintainOrder(params) {
  return request('/maintenance/search', {
    method: 'POST',
    body: params,
  });
}

export async function cancelMaintainOrder(params) {
  return request('/maintenance/cancel', {
    method: 'POST',
    body: params,
  });
}

export async function searchSysMaintainRuler(params) {
  return request('/maintenance/searchmaintenanceruler', {
    method: 'POST',
    body: params,
  });
}

export async function addMaintenanceruler(params) {
  return request('/maintenance/addmaintenanceruler', {
    method: 'POST',
    body: params,
  });
}

export async function searchBrandbylogin() {
  return request('/basedata/findbrandbylogin', {
    method: 'GET',
  });
}

export async function searchDealerbylogin() {
  return request('/basedata/finddealerbylogin', {
    method: 'GET',
  }).then(e => e.data);
}

export async function getSeries(params) {
  return request('/basedata/seriesbybrandids', {
    method: 'POST',
    body: params,
  });
}

export async function updateMaintenanceRuler(params) {
  return request('/maintenance/editmaintenanceruler', {
    method: 'POST',
    body: params,
  });
}

export async function deleteMaintenanceRuler(params) {
  return request('/maintenance/deletemaintenanceruler?sid=${params}');
}

